1. 17.2 SVM算法api初步使用

1.1. 学习目标

  • 知道SVM算法API的用法

>>> from sklearn import svm
>>> X = [[0, 0], [1, 1]]
>>> y = [0, 1]
>>> clf = svm.SVC()
>>> clf.fit(X, y)  
SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0,
 decision_function_shape='ovr', degree=3, gamma='scale', kernel='rbf',
 max_iter=-1, probability=False, random_state=None, shrinking=True,
 tol=0.001, verbose=False)

在拟合后, 这个模型可以用来预测新的值:

>>> clf.predict([[2., 2.]])
array([1])
Copyright © MISIN 2022 | 豫ICP备2023040351号-1 all right reserved,powered by Gitbook该文件修订时间: 2024-01-12 07:58:59

results matching ""

    No results matching ""